<!DOCTYPE html>
<html ng-app="employeeModule">
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="/bower_components/angular/angular.js"></script>
    <script>
        function Querier(argScope) {
            this.data = [];
            this.argScope = argScope;
        }

        Querier.prototype.query = function () {
            console.log('query', this.$parent.UserQuery);
        };

        angular.module('employeeModule', [])
                .directive('gQuerier', function () {
                    return {
                        scope: true,
                        priority: 500,
                        link: function ($scope, $element, $attributes) {
                            var $parent = $scope.$parent,
                                    querier = $attributes.gQuerier;
                            if (!$parent.hasOwnProperty(querier)) {
                                $parent[querier] = new Querier($scope);
                                $scope.query = $parent[querier].query;
                            }
                        }
                    }
                })
                .directive('gService', function () {
                    return {
                        scope: {
                            url: '@gService'
                        },
                        link: {
                            pre: function ($scope) {
                                console.log($scope.url)
                            }
                        }
                    }
                })
    </script>
</head>
<body ng-controller="employeeController" g-service="/system/employees">
<!--<br/>
controller: {{name}}

<form g-querier="UserQuery">
    <input type="text" ng-model="name"/><br/>
    <input type="text" ng-model="name2"/><br/>
    <button type="submit" ng-click="query()">查询</button>
</form>
<g-grid g-querydata="UserQuery">
    <g-pagination></g-pagination>
</g-grid>


<form g-querier="UserQuery2">
    querier:{{UserQuery.query.name}}
    <input type="text" ng-model="name"/><br/>
    <button type="submit" ng-click="query()">查询</button>
</form>
<g-grid g-querydata="UserQuery2">
    {{UserQuery.data}}
    <g-pagination></g-pagination>
</g-grid>-->
</body>
</html>